package com.jingtai.platform.controller.merchants;

import com.jingtai.core.entity.BaseEntity;
import com.jingtai.core.entity.member.MemberInfo;
import com.jingtai.platform.service.merchants.MemberInfoService;
import com.jingtai.platform.util.ResultUtil;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import com.jingtai.validate.swagger.CApiParam;
import org.springframework.web.servlet.ModelAndView;

/**
 * 用户表
 *
 * @author sunlaiqian
 * @date 2020-12-02 18:31:31
 */
@Validated
@RestController
@RequestMapping("/platform/memberinfo")
@Api(tags = "用户表")
public class MemberInfoController{

    @Autowired
    private MemberInfoService memberInfoService;


    @ApiOperation("用户表列表查询")
    @GetMapping("/list")
    public ResultUtil aopMemberInfoList(@CApiParam(name = "page",value = "页数",required = true,cNotEmpty = true,cIntMin = 1) @RequestParam("page") Integer page,
                              @CApiParam(name = "limit",value = "每页个数",required = true,cNotEmpty = true,cIntMin = 1) @RequestParam("limit") Integer limit,
                              @CApiParam(name = "conditions",value = "查询条件",required = false) @RequestParam("conditions") String conditions){
        return memberInfoService.MemberInfolist(page, limit, conditions);
    }


    @ApiOperation("根据ID查询memberInfo实体")
    @GetMapping("/getMemberInfoById")
    public ResultUtil GetMemberInfoById(@CApiParam(name = "id",value = "memberInfo实体ID",required = true,cNotEmpty = true) @RequestParam("id") Long id){
        return memberInfoService.getMemberInfoById(id);
    }

    @ApiOperation("新增memberInfo实体")
    @PostMapping("/add")
    @ApiOperationSupport(ignoreParameters = {"memberInfo.id","memberInfo.createTime","memberInfo.updateTime","memberInfo.deleteFlag"})
    public ResultUtil aopAddMemberInfo(@RequestBody @Validated({BaseEntity.Create.class}) MemberInfo memberInfo){
        return memberInfoService.addMemberInfo(memberInfo);
    }

    @ApiOperation("编辑memberInfo实体")
    @PostMapping("/edit")
    @ApiOperationSupport(ignoreParameters = {"memberInfo.createTime","memberInfo.updateTime","memberInfo.deleteFlag"})
    public ResultUtil aopEditMemberInfo(@RequestBody @Validated({BaseEntity.Update.class}) MemberInfo memberInfo){
        return memberInfoService.editMemberInfo(memberInfo);
    }

    @ApiOperation("根据ID删除memberInfo实体")
    @GetMapping("/delMemberInfoById")
    public ResultUtil aopDelMemberInfoById(@CApiParam(name = "id",value = "memberInfo实体ID",required = true,cNotEmpty = true) @RequestParam("id") Long id){
        return memberInfoService.delMemberInfoById(id);
    }

}






